"use strict";

function initSDK(e, n) {
    var r = win[key] = new BrowserLogger(e);
    r.sendPipe(n);
    var i = r._conf;
    return !1 !== i.autoSendPv && r.sendPV(), i && i.useFmp || r.sendPerformance(), 
    i && i.sendResource && r.sendResources(), win[initFlag] = !0, r;
}

function initCdnBlSDK() {
    if (win[initFlag]) return win[key];
    var e = {}, n = [];
    return key in win && (e = win[key].config || {}, n = win[key].pipe || []), initSDK(e, n);
}

var win = window, BrowserLogger = win.BrowserLogger = require("./biz.browser/clazz"), key = require("./util").key, initFlag = "__hasInitBlSdk";

BrowserLogger.singleton = function(e, n) {
    return win[initFlag] ? win[key] : initSDK(e, n);
}, BrowserLogger.createExtraInstance = function(e) {
    e && "object" == typeof e && !0 !== e.enableInstanceAutoSend && (e.enableInstanceAutoSend = !1);
    var n = new BrowserLogger(e), r = n._conf;
    return r.enableInstanceAutoSend && (!1 !== r.autoSendPv && n.sendPV(), r && r.useFmp || n.sendPerformance(), 
    r && r.sendResource && n.sendResources()), n;
};

var isBrowser = "object" == typeof window && !!window.navigator;

isBrowser && win[key] && (BrowserLogger.bl = initCdnBlSDK(win.__hasInitBlSdk)), 
module.exports = BrowserLogger;